

	var openpanel ="";
	var topHead = "-220px"; 
	var topContainer = "26px";
	var metanavopen = false; 


	// getLayerRef
	function getLayerRef ( /* String */ id, 
												 /* optional HTML-Object */ document) {
		if (!document)
			document = window.document;
		if (document.layers) {
			for (var l = 0; l < document.layers.length; l++)
				if (document.layers[l].id == id)
					return document.layers[l];
			for (var l = 0; l < document.layers.length; l++) {
				var result = getLayerRef(id, document.layers[l].document);
				if (result)
					return result;
			}
			return null;
		} else if (document.all) {
			return document.all[id];
		} else if (document.getElementById) {
			return document.getElementById(id);
		}
	}



	function setVisibility( /* Layer */ objLayer, /* boolean */ visible ) 
	{
		if(document.layers){
			objLayer.display = (visible == true) ? 'none' : 'block';
		} else {
			objLayer.style.display = (visible == true) ? 'block' : 'none';
		}
	}



	function displayPanel( /* String */ id ) 
	{
		if( openpanel != "") {
			setVisibility( getLayerRef(openpanel), false );
		}
		
		if( openpanel != id ) {
			setVisibility( getLayerRef(id), true );
			openpanel = id; 
		} else {
			setVisibility( getLayerRef(id), false );
			openpanel = ""; 
		}
	}





	function setNavigation()
	{
		var head = getLayerRef( 'head' );
		var container = getLayerRef( 'container' );
		if( topHead == '-220px' ) {
			topHead = '0px';
			topContainer = '246px';
		} else {
			topHead = '-220px';
			topContainer = '26px';
		} 
		head.style.top = topHead;
		container.style.top = topContainer; 
	}
	
	
	
	function setFontSize( size )
	{
		ref = getLayerRef( 'container' );
		ref.style.fontSize = size;
		writeCookie( 'fontsize', size ); 
	}
	
	// Keks lesen
	function readCookie( name ) {
		var cookieValue = "";
		var search = name + "=";
		if(document.cookie.length > 0){
			offset = document.cookie.indexOf(search);
			if (offset != -1) {
				offset += search.length;
				end = document.cookie.indexOf(";", offset);
				if (end == -1) end = document.cookie.length;
				cookieValue = unescape(document.cookie.substring(offset, end))
			}
		}
		return cookieValue;
	}
			
	// Keks schreiben
	function writeCookie(name, value) {
		var expire = "";
		// expire = new Date((new Date()).getTime() + 18748800);
		expire = new Date((new Date()).getTime() + 30 * 24 * 3500000);
		expire = "; expires=" + expire.toGMTString();
		path   = "; path=/";
		// document.cookie = name + "=" + escape(value) + expire;
		document.cookie = name + "=" + escape(value) + expire + path;

	} 
		
		
	function bootstraping()
	{ 
//		fixed = readCookie( 'fixed' );     
//		if( fixed == '0' ) {
//			ref1 = getLayerRef( 'metanav' );
//			ref2 = getLayerRef( 'koerper' );
//			refp1 = getLayerRef( 'main' ); 
//			refp2 = getLayerRef( 'prefs' );
//			refp3 = getLayerRef( 'linkdump' ); 
//			refp4 = getLayerRef( 'blogroll1' );  
//			refp5 = getLayerRef( 'blogroll2' ); 			
//			ref1.style.position = 'absolute';
//			refp1.style.position = 'absolute'; 
//			refp2.style.position = 'absolute'; 
//			refp3.style.position = 'absolute'; 
//			refp4.style.position = 'absolute'; 
//			refp5.style.position = 'absolute';			
//			ref2.style.backgroundAttachment = 'scroll';
//		}
		fontsize = readCookie( 'fontsize' ); 
		if( fontsize != null ) {
			ref = getLayerRef( 'container-body' );
			ref.style.fontSize = fontsize;
		}      
	}

	// imgpopup
	function imgpopup( url, w, h )
	{
		var x = w + 20;
		var y = h + 30;
		var win = window.open("","","width="+x+",height="+y+"resizeable=no,scrollbars=no");
		win.document.open("text/html");
		win.document.write("<html><head><title>"+url+"</title></head><body style=\"font-size:11px;background:#fff;text-align:center;margin:0px;padding:0px;\">");
		win.document.write("<div><a href=\"javascript:this.close()\"><img style=\"border:1px solid #000;\" src=\""+url+"\" width=\""+w+"\" height=\""+h+"\" alt=\""+url+"\" /></a></div>");		
		win.document.write("<a style=\"text-decoration: none; color: #000;\" href=\"javascript:this.close()\">Fenster schlie&szlig;en");
		win.document.write("</body</html>");
		win.document.close();
		return true
	} 

	window.onload = function() {
			bootstraping();
	}


	function setMetnavHeight() {
		ref = getLayerRef( 'metanav' ); 
		ref2 = getLayerRef( 'metanavbox' ); 
		if( metanavopen == true ) {
			var mh = "22px";
			var mhv = 'none';
			metanavopen = false; 
		} else {
			var mh = "220px";
			var mhv = 'block';
			metanavopen = true;
		}
		ref.style.height = mh;
		ref2.style.display = mhv;
		
	}


	function callXMLHTTPdata( fn, query, obj ) {
		var xmlobj;
		var post; 
		var uri;
		
		xmlobj = false; 
		uri = "/ajax/journal/HTMLHTTP_Response.php";
	
		post = "&fn="+escape(fn);
		post = post + "&query="+escape(query);
		
		try {
			xmlobj = new ActiveXObject( "Msxml2.XMLHTTP" );
		} catch (e) {
			try {
				xmlobj = new ActiveXObject( "Microsoft.XMLHTTP" );
			} catch (oc) {
				xmlobj = null;
			}
		}
		if(!xmlobj && typeof XMLHttpRequest != "undefined")
			xmlobj = new XMLHttpRequest();
	
		if( xmlobj ) {    

			var sh = document.getElementById( obj );
			sh.innerHTML = '<div class="sbox-a"><div class="sbox-b"><div class="sbox-c nav"><div id="progress">&nbsp;</div></div></div></div>';
		
			xmlobj.open("POST", uri, true);        
			xmlobj.setRequestHeader("Method", "POST " + uri + " HTTP/1.1");
			xmlobj.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
//			xmlObj.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
			xmlobj.onreadystatechange = function() {
				if (xmlobj.readyState != 4) 
					return;
				var status;
				var data;
				status = xmlobj.responseText.charAt(0);
				data = xmlobj.responseText; 
				var sh = document.getElementById( obj );
				sh.style.display = "block"; 
				sh.innerHTML = '<div class="sbox-a"><div class="sbox-b"><div class="sbox-c nav">' + data + '</div></div></div>';
			}
	
			xmlobj.send( post );
			delete xmlobj;			
		}
	}



/*
	window.onload = function() {
			initialiseMenu("menu1", "menu1Starter");
			initialiseMenu("menu2", "menu2Starter");
			initialiseMenu("menu3", "menu3Starter");
			initialiseMenu("menu4", "menu4Starter");
			initialiseMenu("menu5", "menu5Starter");
			bootstraping();
	}
*/	
	
	
	
	
